package com.qxy.practice.concurrent;

import java.util.concurrent.CountDownLatch;

/**
 * @author : 戚欣扬
 * @Description :
 */
public class CountDownLatchDemo {


    public static void main(String[] args) {
        CountDownLatch clock = new CountDownLatch(3);
        for (int i = 3; i >0; i--) {

            int finalI = i;
            new Thread(()->{
                System.out.println("世界即将崩坏，倒计时 ：" + finalI);
                clock.countDown();
            },String.valueOf(i)).start();
        }
        try {
            clock.await();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("天国降临！！！");
    }
}


